<template>
	<view class="top">

		<uni-card style="border-radius: 10px;margin-top: 0px;">
			<view class="example">
				<!-- 基础用法，不包含校验规则 -->
				<uni-forms ref="baseForm" :modelValue="baseFormData" label-width="110px">
					<uni-forms-item label="账户余额">
						<text style="color: #FF6532;">￥{{moneys}}</text>
					</uni-forms-item>
					<uni-forms-item label="提现金额">
						<uni-easyinput style="width: 50%; border-radius: 20px;" :max="170"
							v-model="baseFormData.money" />
					</uni-forms-item>

					<uni-forms-item label="真实姓名">
						<uni-easyinput style="width: 50%;" v-model="baseFormData.cardName" placeholder="" />
					</uni-forms-item>
					<uni-forms-item label="请选择银行" style="width: 80%;">
						<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
					</uni-forms-item>
					<uni-forms-item label="请输入银行卡号">
						<uni-easyinput v-model="baseFormData.card" placeholder="" />
					</uni-forms-item>
				</uni-forms>
				<view style="font-size: 10px;text-align: center;">车联网服务平台不会通过任何渠道泄露您的个人信息，请放心填写</view>
				<button class="button" type="primary" @click="confirm_btn">确认信息并提交</button>
			</view>
		</uni-card>

		<uni-card style="border-radius: 10px;">
			<view class="tit">提现记录</view>
			<u-divider text=""></u-divider>

			<view v-for="(item,index) in lists" :key="index">
				<uni-section style="margin-top: -10px;margin-bottom: -10px;" :title="item.cardName + '商家提现申请'"
					:sub-title="`核销时间:${item.verificationTime}`">
					<template v-slot:right>
						<view
							style="display: flex;flex-direction: column; justify-content: flex-end; text-align: right;">
							<text style="color:#FF6532 ;text-align: right;">-{{item.money}}</text>
							<text>审核通过</text>
						</view>
					</template>
				</uni-section>
				<u-divider text=""></u-divider>
			</view>

			<!-- <uni-section style="margin-top: -10px;margin-bottom: -10px;" title="商家提现申请"
				sub-title="核销时间:2022-10-12 11:09">
				<template v-slot:right>
					<view style="display: flex;flex-direction: column; justify-content: flex-end; text-align: right;">
						<text style="color:#FF6532 ;text-align: right;">-200</text>
						<text>审核中</text>
					</view>
				</template>
			</uni-section> -->
			<!-- <u-divider text=""></u-divider> -->
			<!-- <uni-section style="margin-top: -10px;margin-bottom: -10px;" title="商家提现申请"
				sub-title="核销时间:2022-10-12 11:09">
				<template v-slot:right>
					<view style="display: flex;flex-direction: column; justify-content: flex-end; text-align: right;">
						<text style="color:#FF6532 ;text-align: right;">-100</text>
						<text>审核不通过</text>
					</view>
				</template>
			</uni-section> -->
		</uni-card>


	</view>
</template>

<script>
	export default {



		data() {
			return {
				baseFormData: {
					shopId: '',
					money: '',
					verificationTime: '',
					state: '',
					bankType: '',
					card: '',
					cardName: ''
				},
				lists: [],
				value: "",
				range: [],
				moneys: 0
			}
		},
		onLoad(options) {

			// console.log(options); // 打印 options 来检查是否有传递参数
			if (options.moneys) {
				this.moneys = Number(options.moneys);
			}
			this.list();
		},
		methods: {
			list() {
				let that = this;
				this.$http({
					url: '/api/shanghuliebiao2/drawal/list',
					method: 'GET',
					success(res) {
						if (res.data.code == 200) {
							that.lists = res.data.rows
							console.log(that.lists)
						}
					}
				})
			},

			confirm_btn() {

				if (this.baseFormData.money > this.moneys) {
					// 弹出提示框
					uni.showToast({
						title: '提现金额不能大于可提现金额',
						icon: 'none',
						duration: 2000
					});
				} else {

					this.$http({
						url: '/api/shanghuliebiao2/drawal',
						method: 'POST',
						data: this.baseFormData,
						success(res) {
							// if (res.data.code == 200) {
							console.log(res)
							uni.$u.route('/pages/ly/budget/payoutsuccess')
							// }
						}
					})


					// this.$http({
					//   url: 'https://api.52vmy.cn/api/query/bankinfo?word=' + this.baseFormData.card,
					//   method: 'GET',
					//   success(res) {
					//     if (res.data.code == 200) {
					//       // 在这里处理成功的响应

					//     }else{
					// 		alert("银行卡验证失败")
					// 	}
					//   }
					// })







				}
			}
		}
	}
</script>

<style>
	.top {
		height: 150px;
		background-image: url(../../../static/images/ly/组 6.png);
	}

	.button {
		height: 30px;
		width: 250px;
		font-size: 15px;
		background-color: #3486FD;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 10px;
	}

	.tit {
		font-size: 16px;
		font-weight: bold;
	}
</style>